home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / PORT / PORTING.LOG next >
Encoding:
Text File  |  1994-08-02  |  14.2 KB  |  378 lines

  1. ================================================================================
  2. STEP 01: try "make -n" to see initial problems:
  3.  
  4. % make -n
  5. make: file `Makefile' line 74: bad character '&' (octal 46) (bu40)
  6. make: fatal error: .
  7.  
  8. *** FILES: step1/MK.LOG 
  9.  
  10. Examination of the Makefile indicates that there are some conditionals,
  11. apparently requiring a special version of the Make program.  Since
  12. "make" on this machine complains, it seems best to just remove these
  13. conditionals.  Looking at the Makefile and the crypt.* files indicates
  14. that these have to do with encryption.  We'll build a version without
  15. encryption - it can always be added later after logistical details are
  16. solved. The old Makefile is saved in PORT/dist/, and a copy is made
  17. which is edited to select the non-crypt case.
  18.  
  19. *** FILES: step1/Makefile step1/Makefile.diff
  20.  
  21. ================================================================================
  22. STEP 02: Try "make -n" again:
  23.  
  24. % make -n
  25.  
  26. *** FILES: step2/MK.LOG 
  27.  
  28. This time, it appears the Makefile has no further syntax problems
  29. from the viewpoint of this version of "make".
  30.  
  31. Before trying an actual make, however, it seems to make sense to do a
  32. rudimentary check for proper defines and other makefile changes.
  33. There's no helpful README file that tells us what the defines mean, so
  34. some guesses have to be made.  Neither does there appear to be a
  35. configuration file for site-specific things, so the changes will be
  36. made to the Makefile, and eventually, to the source files.
  37.  
  38. The makefile uses NETBSD_DEFINES, which is set to:
  39.  
  40. NETBSD_DEFINES          = -UMACH -DVAR_TMP -DHAS_DAEMON
  41.  
  42. Concatenated with these are two more defines, -UCMUCS -UCMU.
  43.  
  44. All these would appear to make sense at first glance; the undefines
  45. presumably remove behavior specific to the CMU general environment, CMS
  46. CS Dept., and to the Mach O.S.  We want to build the full version, so
  47. HAS_DAEMON seems to make sense.  And the /var/tmp is the proper
  48. location under the ABI, so that define seems to make sense also.
  49.  
  50. The installation parameters will need to be adjusted for the proper
  51. location, but for now they're okay, as we won't be doing a "make
  52. install" right off the bat.
  53.  
  54. Down where the library inclusions are defined, there's a problem:
  55. NETBSD_LIBS is set to -lutil, and there's no "util" library under the
  56. ABI.  Unfortunately, there's also no documentation in this program that
  57. indicates that the necessary routines are, so we'll wait for the loader
  58. to tell us what's undefined and see if we can find out if those
  59. routines exist in a standard place.
  60.  
  61. Finally, since ABI-compilant compiles are going to be done with the
  62. abicc and abild scripts, we check that all invocations of the compiler
  63. and loader are done using macros, not direct command names (they are),
  64. and then set up the proper defines for the macros.
  65.  
  66. *** FILES: step2/Makefile step2/Makefile.diff
  67.  
  68. ================================================================================
  69. STEP 03: Let's try a "make -i".  Using -i tells make not to stop on a
  70. fatal error; this may either lead to reams of output for each single
  71. file, or it may allow us to spot several different types of problems;
  72. it may possibly even let some of the source files compile correctly!!!
  73. picture
  74.  
  75. (see step3/MK.LOG for results).
  76.  
  77. *** FILES: step3.MK.LOG
  78.  
  79. The error log indicates a number of problems.
  80.  
  81. (a) supcmain.c and run.c have a problem with the definition of the
  82.     "struct sigvec" type.
  83. (b) supcmisc.c, supcmeat.c and scm.c find multiple declarations for a routine
  84. (c) expand.c has a number of warnings for conflicting declarations
  85. (d) the ranlib program is called by the makefile and is not found
  86. (e) supfileserv.c has two apparent syntax errors ("Unterminated string or
  87.     character constant")
  88.  
  89. Taking these in order,
  90.  
  91. (a) is a slightly messy problem.  It is caused because of the use of
  92. BSD-style signals, which is not the default behavior.  The choices are
  93. to enable BSD signals, or to port the signal handling to SVR4 style.
  94. Since there is an ABI equivalent, let's do the conversion.
  95.  
  96. *** FILES: step3/supcmain.c step3/supcmain.c.diff
  97.     step3/run.c step3/run.c.diff
  98.  
  99. (b) is an error because of the lack of prototype declarations,
  100. basically.  The routine is implicitly declared by being called, then
  101. later has a prototype-style declaration then the routine is declared. A
  102. "forward" declaration is needed at the top of the file.
  103.  
  104. *** FILES: step3/supcmisc.c step3/supcmisc.c.diff
  105.     step3/supcmeat.c step3/supcmeat.c.diff
  106.     step3/scm.c step3/scm.c.diff
  107.  
  108. (c) is an issue that could be cleared up by creating prototypes for the
  109. offending functions - which are each implicity not static by being
  110. called earlier, then explicitly being declared static later.  Since
  111. this is a harmless warning, however, we'll leave the file alone for now.
  112.  
  113. *** FILES: none
  114.  
  115. (d) ranlib removed from the Makefile
  116.  
  117. *** FILES: step3/Makefile step3/Makefile.diff
  118.  
  119. (e) - the syntax error in lines 1143 and 1144 is actually a line that
  120. has been broken inside a string, this is normally not allowed.  The
  121. lines are concatenated into one.
  122.  
  123. *** FILES: step3/supfilesrv.c step3/supfilesrv.c.diff
  124.  
  125. ================================================================================
  126. STEP 04: Run "make -i" again to test the fixes
  127.  
  128. *** FILES: step7.MK.LOG
  129.  
  130. (a) supfilesrv.c has the same sigvec problems fixed in other files,
  131. which were not noticed because the make on this file had failed 
  132. earlier on.  Signal usage converted to ABI style.
  133.  
  134. *** FILES: step4/supfilesrv.c step4/supfilesrv.c.diff
  135.  
  136. (b) since the -lutil library is not found, comment it out and let's
  137. see what comes up undefined.
  138.  
  139. *** FILES: step4/Makefile step4/Makefile.diff
  140.  
  141. ================================================================================
  142. STEP 05: Run "make -i" again to test the fixes
  143.  
  144. *** FILES: step5/MK.LOG
  145.  
  146. linking sup generates a warning about a multiple define, and a list of
  147. unresolveds, which can be recognized as BSD-specific routines.  The
  148. networking-related routines are, for the most part, in libnsl and
  149. libsocket for the ABI, so those libraries will need to be included in
  150. the Makefile.  The rest will have to be handled in other ways.  linking
  151. supscan generates a shorter list of undefineds, these don't have any
  152. network dependencies in them; so supscan does not get libnsl/libsocket.
  153.  
  154. *** FILES: step5/Makefile step5/Makefile.diff
  155.  
  156. supfilesrv.c has a forward declaration problem to fix.
  157.  
  158. *** FILES: step5/supfilesrv.c step5/supfilesrv.c.diff
  159.  
  160. ================================================================================
  161. STEP 06: Run "make -i" again to test the fixes
  162.  
  163. *** FILES: step6/MK.LOG
  164.  
  165. There are two classes of remaing build problems:
  166.  
  167. the multiply defined "cryptbuf" and "cryptflag" symbols from
  168. scmio.c and netcrypt.c
  169.  
  170. the undefined symbols.  The following list is extracted
  171. from step9.MK.LOG, sorted and duplicates removed; then
  172. grouped by functional area:
  173.  
  174. bcmp bcopy bzero - use memory(3) routines
  175.     replace with calls to memcmp, memcpy, memset
  176. index rindex - use string(3) routines
  177.     replace with strchr, strrchr
  178. strcasecmp strncasecmp - string routines without direct equivalents
  179.     either pull the static objects out of some other library,
  180.     or find the sources in the public domain somewhere.
  181. daemon - unkown routine
  182. flock - advisory record locking 
  183. getdtablesize - find number of file descriptors
  184. gethostname - replace with uname(2) call
  185. major - ???
  186. sigblock sigmask sigsetmask sigvec - signal routines, replace with SVR4 style
  187. utimes - replace with utime(2) call
  188. vfork - can probably replace with fork(2)
  189. vsnprintf - ???
  190. wait3 - replace with waitpid or waitid ???
  191.  
  192.  
  193. It is not strictly necessary to port all of these routines to the SVR4
  194. equivalents, since there's a BSD emulation library.  However, the
  195. emulation routines are not always well supported, and specifying the
  196. emulation library will bring in other BSD functions as well, for
  197. example, the BSD printf instead of the SVR4 printf.  In general, it is
  198. better to complete the port to fully supported interfaces.
  199.  
  200. Since there are a large number of changes to apply, this will be broken
  201. up into several steps.
  202.  
  203. The list of files is saved into step6/UNDEF-LIST A "grep" is done on
  204. all the current sources and the results for each source file is saved
  205. to step6/UNDEF/
  206.  
  207.  
  208. (a) The strcasecmp issue is resolved by including a copy of the
  209.     file found in the ghostview distribution (for example, in
  210.     public/ghostvie on the SGI Developer Toolbox CD, or obtainable
  211.     on the Internet in many places).  The makefile is modified to
  212.     include this file in the library libextra.a.
  213.  
  214. *** FILES: step06/strcasecmp.c step06/Makefile step06/Makefile.diff
  215.  
  216. (b) daemon - the deamon routine is not in any of the ABI libraries.
  217.     It's not very complicated, however; and is simply added to the
  218.     directory from the NetBSD libutil library.
  219.  
  220. *** FILES: step06/Makefile step06/Makefile.diff step06/daemon.c
  221.     
  222.  
  223. (c) getdtablesize - supcmain.c, supfilesrv.c changed to use getrlimit
  224.     sysent.h also updated
  225.  
  226. *** FILES: step06/supcmain.c step06/supcmain.c.diff
  227.     step06/supfilesrv.c step06/supfilesrv.c.diff
  228.     step06/sysent.h step06/sysent.h.diff
  229.  
  230. (d) gethostname - scm.c, supscan.c  changed to use uname
  231.     sysent.h also updated
  232.  
  233. *** FILES: step06/scm.c step06/scm.c.diff step06/supscan.c
  234.     step06/supscan.c.diff step06/sysent.h step06/sysent.h.diff
  235.  
  236. (e) run.c and supcmisc.c were fixed for the signal stuff
  237.     (run.c for a change that hadn't been completely made before)
  238.  
  239. *** FILES: step06/run.c step06/run.c.diff
  240.     step06/supcmisc.c step06/supcmisc.c.diff
  241.  
  242. (f) utimes changes made in scan.c and supcmeat.c
  243.  
  244. *** FILES: step06/scan.c step06/scan.c.diff
  245.     step06/supcmeat.c step06/supcmeat.c.diff
  246.  
  247. (g) vfork changed to fork in run.c
  248.  
  249. *** FILES: step06/run.c step06/run.c.diff
  250.  
  251. (h) while we're at it, investigate the warning from sysent.h - 
  252.     this is harmless, an #else directive is follwed by text which
  253.     is not commented, but fix it anyway.
  254.  
  255. *** FILES: step06/sysent.h step06/sysent.h.diff
  256.  
  257. ================================================================================
  258. STEP 07: run "make -i" to see the effect of these changes. For
  259. simplicity, all the .o and .a files were removed first, so this
  260. is a "clean" build.
  261.  
  262. *** FILES: step07/MK.LOG
  263.  
  264. This time there are new warnings from the preprocessor which wants
  265. "#endif /* stuff */" instead of "#endif stuff".  We won't worry about
  266. those (in c.h and sup.h) unless we have occaasion to change those
  267. files for other reasons.
  268.  
  269. The unresolved complaints from the previous step still fail:
  270.  
  271.     bcopy/bcmp/bzero,
  272.     index/rindex,
  273.     flock,
  274.     wait3,
  275.     vsnprintf,
  276.     major
  277.  
  278. (a) There are some warnings associated with opendir and readdir.
  279. This highlights another ABI issue: the directory(3) routines
  280. are slightly different in the ABI (and in System V in general)
  281. than in BSD.  These are resolved by including the proper file
  282. (dirent.h instead of sys/dir.h) and changing the type of a
  283. variable to the right kind.  While we're at it, add the prototypes
  284. to expand.c to quiet down the warnings from that file (see STEP 03)
  285.  
  286. *** FILES: step07/expand.c step07/expand.c.diff
  287.     step07/scan.c step07/scan.c.diff
  288.  
  289. (b) Resolve the multiple define of cryptflag and cryptbuf from scmio.c
  290. and netcrypt.c by making them extern in scmio.c.
  291.  
  292. *** FILES: step07/scmio.c step07/scmio.c.diff
  293.  
  294. (c) vsnprintf - this appears to be an effort to use a version of
  295. vsprintf which automatically terminates the string just written, even
  296. if the destination buffer was too small.  Since the "workaround"
  297. routine in the file vprintf.c uses a non-ABI entry point "_doprnt", we
  298. can't use that workaround.  As a temporary, to be revisited, just
  299. add a stub in vprintf.c to call vprintf.
  300.  
  301. *** FILES: step07/vprintf.c step07/vprintf.c.diff
  302.  
  303. (d) major - this call (traditionally a macro) is used in somewhat
  304. questionable code to try and determine whether a file is on an
  305. NFS-mounted volume or not.  The macro is now defined in <sys/sysmacros.h>,
  306. so that could be included, but it would be nice to have a more
  307. general way to determine if a file is on an NFS volume or not.
  308. For now, add the include file and make a note to go back and visit
  309. this later.
  310.  
  311. *** FILES: step07/supfilesrv.c step07/supfilesrv.c.diff
  312.  
  313. (e) wait3 - calls replaced with code using waitpid(2)
  314.  
  315. *** FILES: step07/run.c step07/run.c.diff
  316.     step07/supfilesrv.c step07/supfilesrv.c.diff
  317.  
  318. (f) flock - code replaced with simlilar code using fcntl.  The server
  319. process tries to place a shared lock on the file.  The client process
  320. tries for an exclusive lock, then if that fails, tries for a shared
  321. lock and places a blocking call for an exclusive lock.  The terminology
  322. for fcntl refers to write locks instead of exclusive locks and read
  323. locks instead of shared locks, but they intend the same thing, so
  324. we'll be using those.
  325.  
  326. (g) bcopy/bcmp/bzero
  327. (h) index/rindex
  328.  
  329. These routines each have direct equivalents as memcpy, memcmp, memset,
  330. strchr, and strrchr.  (Actually, there may be some overlap implications
  331. of bcopy that are different than memcpy, but we probably don't need 
  332. to worry about that.  For those which take arguments in the same order,
  333. a simple #define can be used:
  334.  
  335.     #define index strchr
  336.  
  337. If this method is used, it is important to check that "index" and "rindex"
  338. aren't used of other purposes in the program, and are affected by such
  339. defines.  Macro defines can also be used:
  340.  
  341.     #define index(s, c) strchr(s, c)
  342.  
  343. This latter approach must be used if arguments need to be swapped around.
  344.  
  345.     #define bcopy(s, d, l) memcpy(d, s, l)
  346.  
  347. These defines need to be inserted either at the head of each file
  348. that uses the routines, or in a global header file (but this package
  349. doesn't have one).
  350.  
  351. Of course the code could also be changed at each instance, either
  352. by repaclement or #ifdef.
  353.  
  354. In this example port, to avoid making TOO many changes (there are
  355. 78 instances of these five calls), stub routines are put into a
  356. new source file instead.
  357.  
  358. *** FILES: step07/Makefile step07/Makefile.diff step07/port.c
  359.  
  360. ================================================================================
  361. STEP 08:  Having made all these changes, try the build again.
  362.  
  363. *** FILES: step08/MK.LOG
  364.  
  365. All the programs build!
  366.  
  367. We now run the Application Compliance Testing (ACT) tool on the
  368. binaries to see if they appear ABI-comforming.  
  369.  
  370. *** FILES: step08/sup.ACT step08/supfilesrv.ACT step08/supscan.ACT
  371.  
  372. supscan is clean; the other two have three network-related symbols.
  373.  
  374. ================================================================================
  375. TO check: 
  376. vsnprintf
  377. major
  378.